package io.iec.edp.caf.data.source.gauss;

import io.iec.edp.caf.data.source.RelationalServiceInfo;

public class OpenGaussServiceInfo extends RelationalServiceInfo {
    public static final String OPENGAUSS_SCHEME = "opengauss";
    public static final String OPENGAUSS_DRIVER_CLASS_NAME = "org.opengauss.Driver";

    public OpenGaussServiceInfo(String uriString) {
        super(uriString);
    }

    public OpenGaussServiceInfo(String host, int port, String username, String password, String path, String query) {
        super(OPENGAUSS_SCHEME, host, port, username, password, path, query);
    }

    /**
     * 高斯数据库url使用的schema是postgresql
     * @return
     */
    @Override
    protected String buildJdbcUrl() {
        return String.format("%s%s://%s%s/%s%s", JDBC_PREFIX, OPENGAUSS_SCHEME, getHost(), formatPort(),
                getPath(),formatQuery());
    }

    /**
     * 获取驱动类名
     * @return
     */
    @Override
    public String getDriverClassName(){
        return OPENGAUSS_DRIVER_CLASS_NAME;
    }
}
